/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       viewport.h
 * Author:     karooolek
 * Created on: Oct 15, 2009
 *
 **********************************************************************************************************************/

#ifndef VIEWPORT_H_
#define VIEWPORT_H_

#include "rendertarget.h"
#include "glee.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Rendering viewport.
 * Single viewport in render window.
 * Viewport is specifed by lower left corner position and size, 
 * both in window coordinates.
 */
class Viewport : public RenderTarget
{
protected:
    /**
     * Position.
     */
    Vector2 _position;

public:
    /**
     * Create viewport.
     */
    Viewport();

    /**
     * Create viewport with specified position and size.
     * @param position position.
     * @param size size.
     */
    Viewport(const Vector2 &position, const Vector2 &size);

    /**
     * Destroy viewport.
     */
    virtual ~Viewport();
    
    /**
     * Get viewport position.
     * @return viewport position.
     */
    const Vector2 &getPosition() const
    {
        return _position;
    }

    /**
     * Set viewport position.
     * @param position position.
     */
    void setPosition(const Vector2 &position)
    {
        _position = position;
    }
    
    /**
     * Begin rendering to viewport.
     */
    virtual void beginRendering();
    
    /**
     * End rendering to viewport.
     */
    virtual void endRendering();
};

}
}

#endif // VIEWPORT_H_
